const db = require('../db/index.js')

exports.useTest = (req, res) => {
    const sqlStr = 'SELECT * FROM my_table'
    db.query(sqlStr, (err, result) => {
        if (err) return console.log(err)
        const data =  result.map(item => ({
            id: item.id,
            json_data: JSON.parse(item.json_data)
        }))
        res.send(data)
    })
}

const obj = [
    { id: 1, key: "你好" },
    { id: 2, key: "第二" },
]